package main

import (
	"encoding/json"
	"fmt"
)

type servers struct {
	Servers []server `json:"servers"`
}

type server struct {
	ServerName string
	ServerIP   string
}

func main() {
	var srs servers

	srs.Servers = append(srs.Servers, server{"xian", "127.0.0.1"})
	srs.Servers = append(srs.Servers, server{"taiyuan", "128.0.0.1"})
	fmt.Println(srs)
	b, err := json.Marshal(srs)
	if err != nil {
		fmt.Printf("Error %v\n", err)
		return
	}

	fmt.Println(string(b))
}